home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / codeli_1 / setup.exe / _SETUP.1 / ShowPropertiesDialog.bas < prev   
Encoding:
BASIC Source File  |  1997-08-14  |  1.7 KB  |  59 lines

  1. Attribute VB_Name = "ShowPropertiesDialog"
  2. Option Explicit
  3.  
  4. Type SHELLEXECUTEINFO
  5.     cbSize        As Long
  6.     fMask         As Long
  7.     hwnd          As Long
  8.     lpVerb        As String
  9.     lpFile        As String
  10.     lpParameters  As String
  11.     lpDirectory   As String
  12.     nShow         As Long
  13.     hInstApp      As Long
  14.     
  15.     lpIDList      As Long     ' Optional parameter
  16.     lpClass       As String   ' Optional parameter
  17.     hkeyClass     As Long     ' Optional parameter
  18.     dwHotKey      As Long     ' Optional parameter
  19.     hIcon         As Long     ' Optional parameter
  20.     hProcess      As Long     ' Optional parameter
  21. End Type
  22.  
  23. Public Const SEE_MASK_INVOKEIDLIST = &HC
  24. Public Const SEE_MASK_NOCLOSEPROCESS = &H40
  25. Public Const SEE_MASK_FLAG_NO_UI = &H400
  26.  
  27. Declare Function ShellExecuteEX Lib "shell32.dll" Alias "ShellExecuteEx" _
  28. (SEI As SHELLEXECUTEINFO) As Long
  29. Public Function ShowProperties(FileName As String, OwnerhWnd As Long) As Long
  30.   
  31.     ' Open a file properties dialog for specified file if return value
  32.     ' <=32 an error occurred
  33.  
  34.     Dim SEI As SHELLEXECUTEINFO
  35.     Dim r As Long
  36.      
  37.     ' Fill in the SHELLEXECUTEINFO structure
  38.     With SEI
  39.         .cbSize = Len(SEI)
  40.         .fMask = SEE_MASK_NOCLOSEPROCESS Or SEE_MASK_INVOKEIDLIST Or SEE_MASK_FLAG_NO_UI
  41.         .hwnd = OwnerhWnd
  42.         .lpVerb = "properties"
  43.         .lpFile = FileName
  44.         .lpParameters = vbNullChar
  45.         .lpDirectory = vbNullChar
  46.         .nShow = 0
  47.         .hInstApp = 0
  48.         .lpIDList = 0
  49.     End With
  50.      
  51.     ' Call the API
  52.     r = ShellExecuteEX(SEI)
  53.      
  54.     ' Return the instance handle as a sign of success
  55.     ShowProperties = SEI.hInstApp
  56.   
  57. End Function
  58.  
  59.